package org.zachary.creditbusiness.hotel.util;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import org.zachary.commonmodule.entity.MqTransmissionJson;

import java.time.Instant;

@Api(tags = "酒店预订消息队列")
@RestController
@RequestMapping("/hotels")

public class KafkaController {
    private final KafkaProducerService kafkaProducerService;

    public KafkaController(KafkaProducerService kafkaProducerService) {

        this.kafkaProducerService = kafkaProducerService;
    }

    @GetMapping("/kafka")
    public void testKafka(){
        MqTransmissionJson mq=new MqTransmissionJson(
                "7383-gfeh-f4t3-238r",
                101,
                0,
                true,
                3,
                true,
                10000.0,
                "第三次测试",
                Instant.now(),
                Instant.now()
        );
        kafkaProducerService.sendJsonMessage("TestTopic",mq);
    }
}
